/**
 * 协同工作流参数设置， 多个地方调用，一个地方初始化
 */

/**
 * 属性扩展
 * @param paramExt
 * @param infoExt
 */
function _initWfDesigner(paramExt, infoExt){
    
    LazyUtil.addLoadedFn("lazy_wf", function(){
        
        if(pageX.wfDesigner == null){
            
            var wfParams = {
                    workflow : {
                        moduleType : "1",
                        processId : summaryBO["summary"].processId,
                        caseId : summaryBO["summary"].caseId,
                        currentNodeId : summaryBO["summary"].activityId,
                        subObjectId : summaryBO["summary"].affairWorkitemId
                    },
                    info : {
                        //model : "",
                        //wfSelectorId : "",
                        state : "edit_current",
                        dataCacheKey : CollCacheKey.summary.workflow + pageX.winParams.cache_subfix,//数据缓存key
                        //canEdit : null,
                        //beforDrawWf : null,
                        //customerTap : null,
                        //onTriggerEdit : null,
                        defaultPolicyId : summaryBO["defPolicy"]["value"],
                        defaultPolicyName : summaryBO["defPolicy"]["name"],
                        currentAccountId : summaryBO["currentUser"]["loginAccount"],
                        currentAccountName : summaryBO["currentUser"]["loginAccountName"],
                        currentUserId : summaryBO["currentUser"]["id"],
                        currentUserName : summaryBO["currentUser"]["name"],
                        category : "collaboration",
                        workItemId : summaryBO["summary"].affairWorkitemId,
                        affairId : summaryBO["summary"].affairId,
                        summaryId : summaryBO["summary"].id,
                        bodyType : summaryBO["summary"].bodyType,
                        activityId : summaryBO["summary"].activityId,
                        formData : summaryBO["summary"].formRecordId,
                        processTemplateId : summaryBO["summary"].templateProcessId,
                        canTrackWorkflow : summaryBO["canTrackWorkflow"],
                        currentWorkItemIsInSpecial : (summaryBO["summary"].affairSubState == '15' 
                            || summaryBO["summary"].affairSubState == '16' 
                                || summaryBO["summary"].affairSubState == '17'),
                        submitStyleCfg : summaryBO.pageConfig["submitStyleCfg"],
                        isProcessTemplate : summaryBO["summary"].processTemplate
                       
                    },
                    style : {
                        zIndex : 11
                    },
                    getPermissions : function(callback){
                        var params = {"appName":"collaboration",
                                      "summaryId":summaryBO["summary"].id,
                                      "bodyType":summaryBO["summary"].bodyType,
                                      "defaultPolicyId":summaryBO["defPolicy"].value,
                                      "accountId":summaryBO["summary"].accountId,
                                      "isSystemTemplate":summaryBO["summary"].systemTemplate};
                        //获取节点权限
                        $s.Coll.permissions({},params, errorBuilder({
                            success : function(ret){
                                callback(ret);
                            }
                        }))
                    }
                }
            
            //扩展属性
            if(paramExt){
                wfParams = cmp.extend(true, wfParams, paramExt);
            }
            
            if(infoExt){
                wfParams.info = cmp.extend(true, wfParams.info, infoExt);
            }
            
            pageX.wfDesigner = new WorkFlowDesigner(wfParams);
        }
        
        //清空配置
        paramExt = null; 
        infoExt = null;
    });
}